package site.wanjiahao;

import site.wanjiahao.sort.Sort;
import site.wanjiahao.sort.compare.*;
import site.wanjiahao.tools.Asserts;
import site.wanjiahao.tools.Integers;

import java.util.Arrays;

public class Main {

    public static void main(String[] args) {
        Integer[] array = {7, 3, 5, 8, 6, 7, 4, 5};
//        Double[] array = {0.34, 0.47, 0.29, 0.84, 0.45, 0.38, 0.35, 0.76};
//        Integer[] array = Integers.random(1000, 1, 10000);
        testSorts(array,
                new ShellSort());
    }

    static void testSorts(Integer[] array, Sort... sorts) {
        for (Sort sort : sorts) {
            Integer[] newArray = Integers.copy(array);
            sort.sort(newArray);
            System.out.println(Arrays.toString(newArray));
            Asserts.test(Integers.isAscOrder(newArray));
        }
        Arrays.sort(sorts);

        for (Sort sort : sorts) {
            System.out.println(sort);
        }
    }

    static void search() {
        int[] integers = {1, 2, 3, 4, 5, 6, 7};

        System.out.println(BinarySearch.search(integers, 7));

    }


}
